package enumdemo;

public enum TestEnum {
    RED(1,"红色"),BLACK(2,"黑色"),GREEN(3,"绿色");

    public int ori;
    public String color;

    //构造方法默认是私有的
    TestEnum(int ori,String color) {
        this.ori = ori;
        this.color = color;
    }




    public static void main2(String[] args) {
        TestEnum[] testEnums = TestEnum.values();
        for (int i = 0; i < testEnums.length; i++) {
            System.out.println(testEnums[i]+"-->"+testEnums[i].ordinal());
        }/**/

      TestEnum tmp = TestEnum.valueOf("RED");
        System.out.println(tmp);

        //TestEnum t = TestEnum.RED;

        System.out.println(GREEN.compareTo(RED));
    }


    public static void main1(String[] args) {
        TestEnum testEnum = TestEnum.RED;
        switch (testEnum) {
            case BLACK:
                System.out.println("BLACK");
                break;
            case RED:
                System.out.println("RED");
                break;
            case GREEN:
                System.out.println("GREEN");
                break;
            default:
                break;
        }
    }
}
